<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layouts::header"></head>

<body>
<nav th:replace="layouts::navbar"></nav>
    <div class="container">
        <h3>当前动态</h3>
        <hr>
<!--新增动态按钮-->
        <a th:href="@{/forums/new}" class="btn btn-primary btn-sm mb-3">更新动态</a>
        <br>
        <table class="table-bordered table-striped">
            <thead class="thead-dark">
            <tr>
                <th>标题</th>
                <th>发布时间</th>
                <th>发布者ID</th>
                <th>内容</th>
                <th>动作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="aForum : ${forums}">
                <td th:text="${aForum.title}"></td>
                <td th:text="${aForum.postTime}"></td>
                <td th:text="${aForum.unitId}"></td>
                <td th:text="${aForum.content}"></td>
                <td>
                    <a th:href="@{/forums/update(id=${aForum.blogId})}" class="btn btn-info btn-sm">编辑</a>
                    <a
                        th:href="@{/forums/delete(id=${aForum.blogId})}"
                        class="btn btn-danger btn-sm"
                        onclick="if (!(confirm('你确定去删除这个动态吗'))) return false"
                    >删除</a>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</body>

</html>